/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionSupport;
import database.CustomerDAO;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import model.*;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

/**
 *
 * @author Trang
 */
public class CustomerAction extends ActionSupport{
    private Integer cid;
    private List<Customer> customer;
    public CustomerDAO customerDAO = new CustomerDAO();
    
    /**
     * @return the cid
     */
    public Integer getCid() {
        return cid;
    }

    /**
     * @param cid the cid to set
     */
    public void setCid(Integer cid) {
        this.cid = cid;
    }

    /**
     * @return the customer
     */
    public List<Customer> getCustomer() {
        return customer;
    }

    /**
     * @param customer the customer to set
     */
    public void setCustomer(List<Customer> customer) {
        this.customer = customer;
    }
    
     @Action(value = "get-customer", results = {
        @Result(name = "success", location = "/w_customer.jsp")
    })
    public String getcustomer(){
        customer = customerDAO.getAllCustomer();
        
//        title = "Best Selling Products";
//        description = "Best Selling Products on Online Shopping System";      
        return SUCCESS;
    }  
}
